package com.chianghao.qyt.mapper;

import com.chianghao.frame.mybatis.mybatisplus.ChiangHaoBaseMapper;
import com.chianghao.qyt.entity.SysOperationSequence;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface SysOperationSequenceMapper extends ChiangHaoBaseMapper<SysOperationSequence> {

    /**
     * 获取设备的锁
     * @param code 编号
     * @return 返回自增编号的序号
     */
    @Select(value = "select seq from sys_operation_sequence where code=#{code} for update")
    long getLock(@Param("code") String code);


    @Update("update sys_operation_sequence set seq = seq + #{incValue} where code=#{code}")
    int upload(@Param("code") String code,@Param("incValue") int incValue);

}
